//
//  HomeJDCell.m
//  ai2ban
//
//  Created by Luolc on 2018/1/9.
//  Copyright © 2018年 mac book pro. All rights reserved.
//

#import "HomeJDCell.h"

@implementation HomeJDCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self initTheUI];
        
        
    }
    
    return self;
}

- (void)initTheUI {
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = [UIColor whiteColor];
    
    [self createOptionView];
    
    for (int i= 0; i<3; i++) {
        
        CGFloat y = i*HomeAreaViewHeight+39;
        CGRect frame = CGRectMake(0, y, kScreen_Width, HomeAreaViewHeight);
        HomeAreaView *areaView = [[HomeAreaView alloc] initWithFrame:frame andIcon:@"图层-1" andTitle:@"巴黎" andSubTitle:@"浪漫之都"];
        
        [self.contentView addSubview:areaView];
        
    }
    
}

- (void)createOptionView {
    
    UIView *contentView = [[UIView alloc] init];
    contentView.backgroundColor = [UIColor whiteColor];
    contentView.frame = CGRectMake(0, 0, kScreen_Width, 39);
    [self.contentView addSubview:contentView];
    
    UIImageView *imageview = [[UIImageView alloc] init];
    imageview.frame = CGRectMake((kScreen_Width-94)/2.0, (39-13)/2.0, 94, 13);
    imageview.image = [UIImage imageNamed:@"5"];
    [contentView addSubview:imageview];
    
    UIButton *moreBtn = [[UIButton alloc] init];
    [moreBtn setTitle:@"更多 >" forState:UIControlStateNormal];
    [moreBtn setTitleColor: [UIColor colorWithRed:194/255.0 green:194/255.0 blue:194/255.0 alpha:1] forState:UIControlStateNormal];
    moreBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [moreBtn sizeToFit];
    moreBtn.frame = CGRectMake(kScreen_Width-12-moreBtn.width, (39-moreBtn.height)/2.0, moreBtn.width, moreBtn.height);
    [contentView addSubview:moreBtn];

}

@end
